home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / m2 / Turbo_1.lha / modula / docs / FROM_C.DOC < prev    next >
Text File  |  1995-01-24  |  814b  |  37 lines

  1. /*
  2. Exported Modula-2 variables and procedures(ie declared in some defintion module)
  3. follow the simple link name convention:
  4.  
  5. _ModuleName_VaribleName
  6. _ModuleName_ProcedureName
  7.  
  8. Example
  9. =======
  10. Calling InOut.WriteInt from 'C':
  11.  
  12. */
  13.  
  14. /*------------ callM2.c -------------------*/
  15.  
  16. extern InOut_BEGIN(void);
  17. extern InOut_WriteInt(int,int);
  18.  
  19. main()
  20. {
  21.   InOut_BEGIN();/* Must call the initialization body of InOut before using it */
  22.           /* Calling InOut_BEGIN more than once wont do any harm */
  23.   InOut_WriteInt(42,2);
  24. }
  25.  
  26. /*------------------------------------*/
  27.  
  28. /*
  29. Compile with
  30. >dcc -Lmodula:obj callM2.c InOut.o StdIO.o mlib:m2.lib
  31.  
  32. InOut.mod imports StdIO.mod (* include StdIO macros not implemented in c.lib *)
  33.  
  34. For an example of calling a 'C' function from within a Modula module see
  35. directory examples/for_c/ .
  36. */
  37.